Depending on the type of product you are using, the definitions of ‘Parameter’, ‘IO Logic’, ‘AxisStatus’, etc. may be different. This example is based on ‘Ezi-SERVO2’, so please apply the appropriate value depending on the product you are using.
Example)
FM_EZISERVO2_PARAM // Parameter enum when using 'Ezi-SERVO2'
FM_EZIMOTIONLINK2_PARAM // Parameter enum when using 'Ezi-MOTIONLINK2'
[EN]
1. Connect a device. 2. Read the AD conversion value of 1 channel. 3.
Read the AD conversion value of 8 channels. 4. Close connection.
[KR]
1. 장치 연결. 2. 1개 채널의 AD 변환 값 읽기. 3. 8개 채널의 AD 변환 값
읽기. 4. 연결 해제.
bool ReadADValue(int nBdID)
{
unsigned char byChannel = 0; //Channel 0
short shRecv = 0; //2Byte Read Buffer
("---------------------------------- \n");
printf// Read AD (Channel 0)
if (FAS_ReadADValue(nBdID, byChannel, &shRecv) != FMM_OK)
{
("Function(FAS_ReadADValue) was failed.\n");
printf}
else
{
("Read AD Seuccess : Channel[%d] %d\n", byChannel + 1, shRecv);
printf}
return true;
}
[EN]
You can read the AD conversion value for one channel using the
FAS_ReadADValue() function. Meaning of each argument is as follows
sequentially: ‘ID number of the board’, ‘channel number’, ‘variable
pointer to store the AD conversion value’
[KR]
FAS_ReadADValue() 함수를 사용하여 1개 채널에 대해 AD 변환 값 을 읽을 수
있습니다. 해당 함수의 각 인자는 순차적으로 다음을 의미합니다. ‘해당
보드의 ID번호’, ‘채널 번호’, ‘AD 변환 값을 저장 할 변수 포인터’
bool ReadADAllValue(int nBdID)
{
unsigned char byOffset = 0; //Offset Should be 0
; //2Byte Read Buffer * 8
AD_BUFFER adbuffer
("---------------------------------- \n");
printf// Read All AD
if (FAS_ReadADAllValue(nBdID, byOffset, &adbuffer) != FMM_OK)
{
("Function(FAS_ReadADAllValue) was failed.\n");
printf}
else
{
("Read AD All Seuccess\r\n");
printffor (int i = 0; i < 8; i++)
{
("Channel[%d] : %d\r\n", i + 1, adbuffer.channel[i]);
printf}
}
return true;
}
[EN]
You can read AD conversion values for 8 channels using the
FAS_ReadADAllValue() function. Meaning of each argument is as follows
sequentially: ‘ID number of the board’, ‘Offset’, ‘Variable pointer to
store AD conversion values’ Offset must be sent as 0.
[KR]
FAS_ReadADAllValue() 함수를 사용하여 8개 채널에 대해 AD 변환 값 을 읽을
수 있습니다. 해당 함수의 각 인자는 순차적으로 다음을 의미합니다. ‘해당
보드의 ID번호’, ‘Offset’, ‘AD 변환 값들을 저장 할 변수 포인터’ Offset은
0으로 송신해야 합니다.
[EN]
AD_BUFFER is a structure that manages AD conversion values for 8
channels. AD_BUFFER can be found in the header file
(MOTION_DEFINE.h).
[KR]
AD_BUFFER는 8개 채널에 대해 AD 변환 값을 관리하는 구조체 입니다.
AD_BUFFER는 헤더파일 (MOTION_DEFINE.h)에서 확인하실 수 있습니다.
[EN]
1. Please refer to the [01.ConnectionExam] project document for function
descriptions on connecting and disconnecting devices.
[KR]
1. 장치 연결 및 해제에 대한 함수 설명은 [01.ConnectionExam] 프로젝트
문서를 참고하시기 바랍니다.